//
//  Person.m
//  AFN_Test
//
//  Created by Guo Rui on 2017/9/12.
//  Copyright © 2017年 GR Harry. All rights reserved.
//

#import "Person.h"
#import "AppDelegate.h"
#import <objc/message.h>

int sa = 3;

@implementation Person

void extra_eat(id self, SEL _cmd) {
    NSLog(@"eat");
}

void extra_run(id self, SEL _cmd, NSNumber *meter) {
    
    NSLog(@"跑了%@", meter);
}

+ (Person *)person
{
    return [[self alloc] init];
}

+ (BOOL)resolveInstanceMethod:(SEL)sel
{
    if (sel == NSSelectorFromString(@"eat")) {
        class_addMethod(self, sel, (IMP)extra_eat, "v@:");
    }
    else if (sel == NSSelectorFromString(@"run:")) {
        class_addMethod(self, sel, (IMP)extra_run, "v@:@");
    }
    return [super resolveInstanceMethod:sel];
}

//- (void)smile
//{
//    
//}

@end
